/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * supervision_indicadores_aplica.java
 *
 * Created on 2/05/2011, 12:43:44 PM
 */

package sie_invdis;

import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;

import java.text.ParseException;
import java.text.*;

/**
 *
 * @author Michelle
 */
public class supervision_indicadores_aplica extends javax.swing.JFrame {

     private javax.swing.table.DefaultTableModel jtable_modelo;
     private javax.swing.table.DefaultTableModel jtable_modelo_empleado;
     private javax.swing.table.DefaultTableModel jtable_modelo_respuestas;
     private javax.swing.table.DefaultTableModel jtable_modelo_indicadores;

    bd_conexion x = new bd_conexion();
    ResultSet rs = null;

    int fempleadoactual=0, fpreguntaactual=0,fpuestoactual=0,findicadoractual=0,opcioncatalogo=0,controlcomboinsu=0,ccencuesta=0;
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    String textobuscaemplea="";
    /** Creates new form supervision_indicadores_aplica */
    public supervision_indicadores_aplica() {
        this.iniciar_modelo_de_tabla();
        this.iniciar_modelo_respuestas();
        this.iniciar_modelo_empleado();
        this.iniciar_modelo_indicador();
        initComponents();

        jt_catpreguntas.getColumnModel().getColumn(0).setPreferredWidth(5);//tem ent
        jt_catpreguntas.getColumnModel().getColumn(1).setPreferredWidth(15);//tem ent
        jt_catpreguntas.getColumnModel().getColumn(2).setPreferredWidth(25);//familia
        jt_catpreguntas.getColumnModel().getColumn(3).setPreferredWidth(200);//subfam.
        jt_catpreguntas.getColumnModel().getColumn(4).setPreferredWidth(10);//subfam.
        jt_catpreguntas.getColumnModel().getColumn(5).setPreferredWidth(10);//subfam.

        jt_catrespuestas.getColumnModel().getColumn(0).setPreferredWidth(5);//tem ent
        jt_catrespuestas.getColumnModel().getColumn(1).setPreferredWidth(180);//familia
        jt_catrespuestas.getColumnModel().getColumn(2).setPreferredWidth(10);//subfam.

        jt_catempleados.getColumnModel().getColumn(0).setPreferredWidth(10);//tem ent
        jt_catempleados.getColumnModel().getColumn(1).setPreferredWidth(50);//familia
        jt_catempleados.getColumnModel().getColumn(2).setPreferredWidth(160);//subfam.


         java.util.Date fecha=new Date();
         this.jdc_fechaprogramada.setDate(fecha);
         this.jdc_rangoini.setDate(fecha);
         this.jdc_rangofinal.setDate(fecha);

        jt_catindicadores.getColumnModel().getColumn(0).setPreferredWidth(20);//tem ent
        jt_catindicadores.getColumnModel().getColumn(1).setPreferredWidth(180);//familia
        jt_catindicadores.getColumnModel().getColumn(2).setPreferredWidth(50);//subfam.
        jt_catindicadores.getColumnModel().getColumn(3).setPreferredWidth(50);//subfam.
        jt_catindicadores.getColumnModel().getColumn(4).setPreferredWidth(100);//subfam.
        jt_catindicadores.getColumnModel().getColumn(5).setPreferredWidth(10);//subfam.

        this.carga_datos_catindicadores(7,"");

        if (variables_global.getnivelusu()==3)
            {
                textobuscaemplea=String.valueOf(variables_global.getdepartamento());
                opcioncatalogo=1;
            }    
        System.out.println("nivel"+variables_global.getnivelusu()+" "+textobuscaemplea);
         this.setLocation(25,25);
         this.loadcombostatusdocto();
         controlcomboinsu=1;
         this.loadcombotipoencuensta();
            ccencuesta=1;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt_catempleados = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jPanel2 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jt_catpreguntas = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jbtn_guardar = new javax.swing.JButton();
        jLabel6 = new javax.swing.JLabel();
        jtf_obserencuesta = new javax.swing.JTextField();
        jtf_empleadosnombre = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jcbx_filtrosencuenta = new javax.swing.JComboBox();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jt_catrespuestas = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jLabel7 = new javax.swing.JLabel();
        jtf_observarespuesta = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jt_catindicadores = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jcbx_filtrostatus = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jtf_describe = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jdc_fechaprogramada = new com.toedter.calendar.JDateChooser();
        jdc_rangofinal = new com.toedter.calendar.JDateChooser();
        jLabel4 = new javax.swing.JLabel();
        jdc_rangoini = new com.toedter.calendar.JDateChooser();
        jLabel3 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jtf_observaindica = new javax.swing.JTextField();
        jbtn_guardasolicitud = new javax.swing.JButton();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jmni_escape = new javax.swing.JMenuItem();
        jmni_actualizar = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(supervision_indicadores_aplica.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel1.border.title"))); // NOI18N
        jPanel1.setName("jPanel1"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jt_catempleados.setModel(this.jtable_modelo_empleado);
        jt_catempleados.setName("jt_catempleados"); // NOI18N
        jt_catempleados.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_catempleadosMouseClicked(evt);
                if(evt.getClickCount() >= 1)
                {
                    diodblclick(evt);
                    //System.out.println(" double click" );

                }
            }
        });
        jScrollPane1.setViewportView(jt_catempleados);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 358, Short.MAX_VALUE)
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jt_catpreguntas.setModel(this.jtable_modelo);
        jt_catpreguntas.setName("jt_catpreguntas"); // NOI18N
        jt_catpreguntas.setRowHeight(22);
        jt_catpreguntas.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_catpreguntasMouseClicked(evt);
                if(evt.getClickCount() >= 1)
                {
                    dioclick(evt);
                    //System.out.println(" double click" );

                }
            }
        });
        jScrollPane2.setViewportView(jt_catpreguntas);

        jbtn_guardar.setIcon(resourceMap.getIcon("jbtn_guardar.icon")); // NOI18N
        jbtn_guardar.setText(resourceMap.getString("jbtn_guardar.text")); // NOI18N
        jbtn_guardar.setToolTipText(resourceMap.getString("jbtn_guardar.toolTipText")); // NOI18N
        jbtn_guardar.setName("jbtn_guardar"); // NOI18N
        jbtn_guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_guardarActionPerformed(evt);
            }
        });

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jtf_obserencuesta.setText(resourceMap.getString("jtf_obserencuesta.text")); // NOI18N
        jtf_obserencuesta.setName("jtf_obserencuesta"); // NOI18N

        jtf_empleadosnombre.setEditable(false);
        jtf_empleadosnombre.setFont(resourceMap.getFont("jtf_empleadosnombre.font")); // NOI18N
        jtf_empleadosnombre.setName("jtf_empleadosnombre"); // NOI18N

        jLabel12.setFont(resourceMap.getFont("jLabel12.font")); // NOI18N
        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jcbx_filtrosencuenta.setName("jcbx_filtrosencuenta"); // NOI18N
        jcbx_filtrosencuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_filtrosencuentaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtf_empleadosnombre, javax.swing.GroupLayout.PREFERRED_SIZE, 381, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jcbx_filtrosencuenta, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 696, Short.MAX_VALUE)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtf_obserencuesta, javax.swing.GroupLayout.PREFERRED_SIZE, 349, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 131, Short.MAX_VALUE)
                .addComponent(jbtn_guardar)
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_empleadosnombre, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(jcbx_filtrosencuenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtn_guardar)
                    .addComponent(jLabel6)
                    .addComponent(jtf_obserencuesta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
        jPanel3.setName("jPanel3"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        jt_catrespuestas.setModel(this.jtable_modelo_respuestas);
        jt_catrespuestas.setName("jt_catrespuestas"); // NOI18N
        jt_catrespuestas.setRowHeight(22);
        jt_catrespuestas.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_catrespuestasMouseClicked(evt);
                if(evt.getClickCount() >= 1)
                {
                    dioclickres(evt);
                    //System.out.println(" double click" );

                }

            }
        });
        jScrollPane3.setViewportView(jt_catrespuestas);

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jtf_observarespuesta.setText(resourceMap.getString("jtf_observarespuesta.text")); // NOI18N
        jtf_observarespuesta.setName("jtf_observarespuesta"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jtf_observarespuesta, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jtf_observarespuesta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel4.border.title"))); // NOI18N
        jPanel4.setName("jPanel4"); // NOI18N

        jScrollPane4.setName("jScrollPane4"); // NOI18N

        jt_catindicadores.setModel(this.jtable_modelo_indicadores);
        jt_catindicadores.setName("jt_catindicadores"); // NOI18N
        jt_catindicadores.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_catindicadoresMouseClicked(evt);
                if(evt.getClickCount() >= 1)
                {
                    dioclickindica(evt);
                    //System.out.println(" double click" );

                }

            }
        });
        jScrollPane4.setViewportView(jt_catindicadores);

        jcbx_filtrostatus.setName("jcbx_filtrostatus"); // NOI18N
        jcbx_filtrostatus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jcbx_filtrostatusActionPerformed(evt);
            }
        });

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jcbx_filtrostatus, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(504, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbx_filtrostatus, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10))
                .addGap(11, 11, 11))
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel5.border.title"))); // NOI18N
        jPanel5.setName("jPanel5"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jtf_describe.setText(resourceMap.getString("jtf_describe.text")); // NOI18N
        jtf_describe.setToolTipText(resourceMap.getString("jtf_describe.toolTipText")); // NOI18N
        jtf_describe.setName("jtf_describe"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jdc_fechaprogramada.setDateFormatString(resourceMap.getString("jdc_fechaprogramada.dateFormatString")); // NOI18N
        jdc_fechaprogramada.setName("jdc_fechaprogramada"); // NOI18N

        jdc_rangofinal.setDateFormatString(resourceMap.getString("jdc_rangofinal.dateFormatString")); // NOI18N
        jdc_rangofinal.setName("jdc_rangofinal"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jdc_rangoini.setDateFormatString(resourceMap.getString("jdc_rangoini.dateFormatString")); // NOI18N
        jdc_rangoini.setName("jdc_rangoini"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jtf_observaindica.setText(resourceMap.getString("jtf_observaindica.text")); // NOI18N
        jtf_observaindica.setName("jtf_observaindica"); // NOI18N

        jbtn_guardasolicitud.setIcon(resourceMap.getIcon("jbtn_guardasolicitud.icon")); // NOI18N
        jbtn_guardasolicitud.setText(resourceMap.getString("jbtn_guardasolicitud.text")); // NOI18N
        jbtn_guardasolicitud.setToolTipText(resourceMap.getString("jbtn_guardasolicitud.toolTipText")); // NOI18N
        jbtn_guardasolicitud.setName("jbtn_guardasolicitud"); // NOI18N
        jbtn_guardasolicitud.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_guardasolicitudActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jdc_fechaprogramada, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addComponent(jdc_rangoini, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jdc_rangofinal, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jtf_observaindica, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jbtn_guardasolicitud, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(12, 12, 12))
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addComponent(jtf_describe, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_describe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(18, 18, 18)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jdc_fechaprogramada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel4)
                    .addComponent(jdc_rangoini, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jdc_rangofinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 37, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtf_observaindica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(jbtn_guardasolicitud))
                .addGap(28, 28, 28))
        );

        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N

        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N

        jLabel18.setFont(resourceMap.getFont("jLabel18.font")); // NOI18N
        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
        jmni_escape.setName("jmni_escape"); // NOI18N
        jmni_escape.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_escapeActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_escape);

        jmni_actualizar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        jmni_actualizar.setText(resourceMap.getString("jmni_actualizar.text")); // NOI18N
        jmni_actualizar.setName("jmni_actualizar"); // NOI18N
        jmni_actualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_actualizarActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_actualizar);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel16)
                            .addComponent(jLabel17)
                            .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(21, 21, 21))
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 285, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(jLabel18)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel15)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel16)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel17))
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
          if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0)
                {
                    this.dispose();
                }
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jbtn_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_guardarActionPerformed
        // TODO add your handling code here:

     //limpiar la tabla
    int numerofilas=this.jtable_modelo.getRowCount(),error=0;
    String valorrespuesta="";
        for(int i = 0 ;i < numerofilas; i++)
           {
                valorrespuesta=this.jtable_modelo.getValueAt(i, 4).toString();
                if(valorrespuesta.length()== 0)
                    {
                        error=1;
                    }
           }
       if(error == 0)
          {
            this.quitarpreguntas();
            java.util.Vector arreglorespuestas=this.jtable_modelo.getDataVector();
            String preguntasyres_papostgresql=arreglorespuestas.toString();
            preguntasyres_papostgresql=preguntasyres_papostgresql.replace('[','{');
            preguntasyres_papostgresql=preguntasyres_papostgresql.replace(']','}');
            preguntasyres_papostgresql=preguntasyres_papostgresql.replace("null",".");
         
            String texto="select * from x1_supervision_indicadores_res_inser("+findicadoractual+","+fpuestoactual+","+variables_global.getId_empleado()+","+fempleadoactual+",'"+preguntasyres_papostgresql+"','"+this.jtf_obserencuesta.getText().trim().toUpperCase()+"')";

            System.out.println(texto);

            rs=x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
            try {
                 while (rs.next())
                       {
                       if (rs.getInt(1) > 0)
                               {
                                      JOptionPane.showMessageDialog(null,"Guardado Correctament, Gracias", "Sistema Integral(Indicadores) : Alta",1);
                               }
                             else
                               {
                                    JOptionPane.showMessageDialog(null," Error Verifique sus Indicador", "Sistema Integral(Indicadores) : Error",1);
                               }
                      }
            } catch(Exception e)
               {
                   System.out.println(e.getMessage());
                   JOptionPane.showMessageDialog(null,"Indicador Incorrecto Consulte a su Administrador", "Sistema Integral(Indicadores) : Error",1);
               }
            this.LimpiarJTable();
       }
       else
       {
         JOptionPane.showMessageDialog(null," Error Verifique qu todas sus respuestas esten Contestadas", "Sistema Integral(Indicadores) : Error",1);
       }
    }//GEN-LAST:event_jbtn_guardarActionPerformed

    private void jbtn_guardasolicitudActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_guardasolicitudActionPerformed
        // TODO add your handling code here:
       if(this.jtf_describe.getText().toString().length()> 0) {
                  if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0) {
                    this.agregarindicadorgeneral();
                    this.jmni_actualizarActionPerformed(evt);
                    } else {
                    
                    this.jtf_describe.requestFocus();
                    }
          }
       else
            {
                    JOptionPane.showMessageDialog(null,"Antes de Guardar Especifique una Descripcion", "Sistema Integral(Indicadores) : Error",1);
                    this.jtf_describe.requestFocus();
            }
    }//GEN-LAST:event_jbtn_guardasolicitudActionPerformed

    private void jcbx_filtrostatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_filtrostatusActionPerformed
        // TODO add your handling code here:
        if (controlcomboinsu > 0 ) {
            String arreglo_tipoinsu[]=this.jcbx_filtrostatus.getSelectedItem().toString().split(":");
            this.carga_datos_catindicadores(1, arreglo_tipoinsu[0]);
        }
}//GEN-LAST:event_jcbx_filtrostatusActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jmni_actualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_actualizarActionPerformed
        // TODO add your handling code here:
        this.carga_datos_catindicadores(7,"");
    }//GEN-LAST:event_jmni_actualizarActionPerformed

    private void jcbx_filtrosencuentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jcbx_filtrosencuentaActionPerformed
        // TODO add your handling code here:
      if(ccencuesta>0)
      {
        String te[]=this.jcbx_filtrosencuenta.getSelectedItem().toString().split(":");
        this.carga_datos_preguntas(Integer.valueOf(te[0]));
      }
}//GEN-LAST:event_jcbx_filtrosencuentaActionPerformed
private void jt_catpreguntasMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
private void jt_catempleadosMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
private void jt_catrespuestasMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
private void jt_catindicadoresMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
 private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         System.out.println("dio doble  click");
               int fila = jt_catpreguntas.getSelectedRow();
               String idcadena=this.jt_catpreguntas.getValueAt(fila, 0).toString();
               this.carga_datos_respuesta(Integer.valueOf(idcadena));
               fpreguntaactual=fila;
               this.jt_catrespuestas.requestFocus();
               //this.carga_datos_detalleinve(ftienda, ffoliopadre,1,idcadena);
    }
private void diodblclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         System.out.println("dio doble  click");

                int fila = jt_catempleados.getSelectedRow();
    if(JOptionPane.showConfirmDialog(null, "<html><h2><b>Desea aplicar Encuesta al Personal:?<br>"+this.jt_catempleados.getValueAt(fila, 2).toString()+"<b></h2></html>")==0)
        {


                String idcadena[]=this.jt_catempleados.getValueAt(fila, 1).toString().split(":");
                String idcadenaemp[]=this.jt_catempleados.getValueAt(fila, 2).toString().split(":");
                fempleadoactual=Integer.valueOf(idcadenaemp[0]);
                fpuestoactual=Integer.valueOf(idcadena[0]);
                this.carga_datos_preguntas(Integer.valueOf(idcadena[0]));
                         
                this.jt_catpreguntas.requestFocus();
               //this.carga_datos_detalleinve(ftienda, ffoliopadre,1,idcadena);
                this.jtf_empleadosnombre.setText(idcadenaemp[1]);
        }
    }
private void dioclickres(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
          System.out.println("dio doble  click");
          String punto="";
               int fila = jt_catrespuestas.getSelectedRow();
               String idcadena[]=this.jt_catrespuestas.getValueAt(fila, 1).toString().split(":");
    if(JOptionPane.showConfirmDialog(null, "<html><h2><b>Respuesta:"+idcadena[1]+"<br>Puntos:"+this.jt_catrespuestas.getValueAt(fila, 2).toString()+"<br>es Correcto?<b></h2></html>")==0)
            {
               jtable_modelo.setValueAt(idcadena[0], fpreguntaactual,4);
               jtable_modelo.setValueAt(this.jt_catrespuestas.getValueAt(fila, 2).toString(), fpreguntaactual,5);
            
               if( this.jtf_observarespuesta.getText().toString().length()> 0 )
                    {
                    punto=this.jtf_observarespuesta.getText().toString().replace(",", " ");
                    }
               else
                    {
                        punto=".";
                    }
               jtable_modelo.setValueAt(punto, fpreguntaactual,6);
               this.jt_catpreguntas.requestFocus();
               this.LimpiarJTable_respuesta();
               this.jtf_observarespuesta.setText("");
               }
               //this.carga_datos_detalleinve(ftienda, ffoliopadre,1,idcadena);
    }
private void dioclickindica(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         System.out.println("dio doble  indicadores");
        int fila = jt_catindicadores.getSelectedRow();
if(JOptionPane.showConfirmDialog(null, "<html><h2><b>Desea aplicar Indicador:?<br>"+this.jt_catindicadores.getValueAt(fila, 1).toString()+"<b></h2></html>")==0)
        {



                String idcadena[]=this.jt_catindicadores.getValueAt(fila, 1).toString().split(":");
                findicadoractual=Integer.valueOf(idcadena[0]);
                this.carga_datos_empleado(opcioncatalogo,textobuscaemplea);
               //this.carga_datos_detalleinve(ftienda, ffoliopadre,1,idcadena);
        }
    }

private void iniciar_modelo_de_tabla()
    {

        jtable_modelo=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo.addColumn("<html><b>id</b></html>");
        jtable_modelo.addColumn("<html><b>Puesto</b></html>");
        jtable_modelo.addColumn("<html><b>area</b></html>");
        jtable_modelo.addColumn("<html><b>Pregunta</b></html>");
        jtable_modelo.addColumn("<html><b>id res</b></html>");
        jtable_modelo.addColumn("<html><b>valor</b></html>");
        jtable_modelo.addColumn("<html><b>obs</b></html>");
    }
private void iniciar_modelo_respuestas()
    {
        jtable_modelo_respuestas=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_respuestas.addColumn("<html><b>idpreg</b></html>");
        jtable_modelo_respuestas.addColumn("<html><b>Respuesta</b></html>");
        jtable_modelo_respuestas.addColumn("<html><b>valor</b></html>");
    }
private void iniciar_modelo_empleado()
    {
        jtable_modelo_empleado=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_empleado.addColumn("<html><b>Dep.</b></html>");
        jtable_modelo_empleado.addColumn("<html><b>Puesto</b></html>");
        jtable_modelo_empleado.addColumn("<html><b>Nombre</b></html>");
    }
private void iniciar_modelo_indicador()
    {
        jtable_modelo_indicadores=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_indicadores.addColumn("<html><b>status</b></html>");
        jtable_modelo_indicadores.addColumn("<html><b>id/Descripcion</b></html>");
        jtable_modelo_indicadores.addColumn("<html><b>F.Progra</b></html>");
        jtable_modelo_indicadores.addColumn("<html><b>F.Revisado</b></html>");
        jtable_modelo_indicadores.addColumn("<html><b>Rango F. a Evaluar</b></html>");
        jtable_modelo_indicadores.addColumn("<html><b>Observaciones</b></html>");
    }
private void carga_datos_preguntas(int puesto)
    {
       //invoco al metodo que trae el recordset de datos
    System.out.println("indicador:"+findicadoractual+"empleado"+fempleadoactual);
    int yaexiste=0;

        try
         {
            rs = x.sieuno_executediversosv2("select * from x1_supervision_indicadores_aplicados_valores(0,'"+findicadoractual+"','"+fempleadoactual+"') as (id integer, iddocto integer,idempleado integer,idpuesto smallint,idvalortot bigint,idarea smallint,descriparea text,pesoarea numeric,areaobserva text,puntosmaximos numeric);",variables_global.getconexiongral());
            while (rs.next())
                {
                    yaexiste=1;
                }
        }
    catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
 this.LimpiarJTable();
 if (yaexiste==0)
     {
        //voy por el detalle del documento
       Object[] fnewRow = new Object[6];
        try
         {
            rs = x.sieuno_executediversosv2("select * from x1_supervision_indicadores_preguntas("+puesto+") as (id smallint,idarea smallint,descrip text,observa text,idpuesto smallint,idclasif smallint,areadescrip text,puestodescrip text)",variables_global.getconexiongral());
            while (rs.next())
                {
                        fnewRow[0]=rs.getString("id");
                        fnewRow[1]=rs.getString("idpuesto")+":"+rs.getString("puestodescrip");
                        fnewRow[2]=rs.getString("areadescrip");
                        fnewRow[3]=rs.getString("descrip");
                        fnewRow[4]="";
                        fnewRow[5]="";
                        jtable_modelo.addRow(fnewRow);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
 else
    {
        JOptionPane.showMessageDialog(null,"Gracias, tu Indicador ya existe", "Sistema Integral Indicador",1);
    }
}
  private void carga_datos_respuesta(int pregunta)
    {
       //invoco al metodo que trae el recordset de datos
       this.LimpiarJTable_respuesta();
       //voy por el detalle del documento
       Object[] fnewRow = new Object[3];

        try
         {
            rs = x.sieuno_executediversosv2("select * from x1_supervision_indicadores_respuestas("+pregunta+") as (id smallint,idresp smallint,descrip text,valor integer)",variables_global.getconexiongral());
            while (rs.next())
                {
                        fnewRow[0]=rs.getString("idresp");
                        fnewRow[1]=rs.getString("id")+":"+rs.getString("descrip");
                        fnewRow[2]=rs.getString("valor");
                        jtable_modelo_respuestas.addRow(fnewRow);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
      }

  private void carga_datos_empleado(int opcion,String textobusca)
    {
       //invoco al metodo que trae el recordset de datos
       //voy por el detalle del documento
      this.LimpiarJTable_empleados();
       Object[] fnewRow = new Object[3];

        try
         {
            rs = x.sieuno_executediversosv2("select * from x1_supervision_empleados("+opcion+",'"+textobusca+"') as (id integer,nombre text,idtie integer,iddepa smallint,idpuesto smallint,idstatus smallint,foto character varying(80),idsieuno integer,descripdep character varying(80),descrippuesto text);",variables_global.getconexiongral());
            while (rs.next())
                {
                        fnewRow[0]=rs.getString("iddepa")+":"+rs.getString("descripdep");
                        fnewRow[1]=rs.getString("idpuesto")+":"+rs.getString("descrippuesto");
                        fnewRow[2]=rs.getString("id")+":"+rs.getString("nombre");
                        jtable_modelo_empleado.addRow(fnewRow);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
      }
  private void carga_datos_catindicadores(int opcion,String textobusca)
    {
       //invoco al metodo que trae el recordset de datos
       //voy por el detalle del documento
      this.LimpiarJTable_indicadores();
      this.LimpiarJTable();
      this.LimpiarJTable_empleados();
      this.LimpiarJTable_respuesta();
       Object[] fnewRow = new Object[7];

        try
         {
            rs = x.sieuno_executediversosv2("select * from x1_supervision_indicadores_prog_cat("+opcion+",'"+textobusca+"') as (id integer,fechap date,fechaapli date,fecharev date,fechaevaini date,fechaevafin date,descrip text,observa text,id_statu smallint, idsuper integer,statusdes character varying(25), nombresuper character varying(50));",variables_global.getconexiongral());
            while (rs.next())
                {
                        fnewRow[0]=rs.getString("statusdes");
                        fnewRow[1]=rs.getString("id")+":"+rs.getString("descrip");
                        fnewRow[2]="<html><p align=justify>"+this.fechaeuropea(rs.getString("fechap"))+"<br>"+this.DiaSemana(this.fechaeuropea(rs.getString("fechap")))+"</p></html>";
                        if(rs.getString("fecharev") != null )
                            {
                                   fnewRow[3]="<html><p align=justify>"+this.fechaeuropea(rs.getString("fecharev"))+"<br>"+this.DiaSemana(this.fechaeuropea(rs.getString("fecharev")))+"</p></html>";
                            }
                        else
                            {
                                   fnewRow[3]="";
                            }
                        fnewRow[4]="<html><p align=justify>"+this.fechaeuropea(rs.getString("fechaevaini"))+" A "+this.fechaeuropea(rs.getString("fechaevafin"))+"<br>"+this.DiaSemana(this.fechaeuropea(rs.getString("fechaevaini")))+" A "+this.DiaSemana(this.fechaeuropea(rs.getString("fechaevafin")))+"</p></html>";
                        fnewRow[5]=rs.getString("observa");
                        jtable_modelo_indicadores.addRow(fnewRow);
                }
        }
        catch(Exception e)
        {
            System.out.println(e.getMessage());
        }
       this.cambiartamanofilas();
      }
  private void loadcombostatusdocto(){

          this.jcbx_filtrostatus.addItem("3"+":"+"TERMINADOS");
            try
            {
                rs = x.sieuno_executediversosv2("select * from x1_supervision_indicadores_status() as (id smallint,statusdescrip character varying(25));",variables_global.getconexiongral());
               while (rs.next())
                    {
                      this.jcbx_filtrostatus.addItem(rs.getString("id")+":"+rs.getString("statusdescrip"));
                    }
            }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
    }
private void loadcombotipoencuensta(){

          this.jcbx_filtrosencuenta.addItem("1"+":"+"Ventas");
          this.jcbx_filtrosencuenta.addItem("2"+":"+"Caja");
          this.jcbx_filtrosencuenta.addItem("3"+":"+"Almacen");
          this.jcbx_filtrosencuenta.addItem("4"+":"+"Vigilante");
          this.jcbx_filtrosencuenta.addItem("5"+":"+"Gerente");

    }

  void LimpiarJTable_indicadores()
 {
     //limpiar la tabla
    while(jtable_modelo_indicadores.getRowCount()>0)jtable_modelo_indicadores.removeRow(0);
 }

void LimpiarJTable()
 {
     //limpiar la tabla
    while(jtable_modelo.getRowCount()>0)jtable_modelo.removeRow(0);
 }
void LimpiarJTable_respuesta()
 {
     //limpiar la tabla
    while(jtable_modelo_respuestas.getRowCount()>0)jtable_modelo_respuestas.removeRow(0);
 }
void LimpiarJTable_empleados()
 {
     //limpiar la tabla
    while(jtable_modelo_empleado.getRowCount()>0)jtable_modelo_empleado.removeRow(0);
 }
  private void quitarpreguntas()
    {
     int numerofilas=this.jtable_modelo.getRowCount();
        
             for(int i = 0 ;i < numerofilas; i++)
                {
                      jtable_modelo.setValueAt(".",i,3);
                      jtable_modelo.setValueAt(".",i,2);

                }
           //
    }
void cambiartamanofilas()
 {
     //limpiar la tabla
    int numerofilas=this.jtable_modelo_indicadores.getRowCount();
        for(int i = 0 ;i < numerofilas; i++)
           {
                jt_catindicadores.setRowHeight(i, 30);
           }
}

  private String  fechaeuropea(String fecha) {

         //resibe cadena de fecha en formato americano yyyy-MM-dd
        java.util.Date fechaestaeuropa=null;
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";
        try
         {
          fechaestaeuropa = formateadoresta.parse(fecha);
         }
        catch (ParseException e)
          {
             //Error, la cadena de texto no se puede convertir en fecha.
          }
       cadenafecha= formateadorestaeuropa.format(fechaestaeuropa);
       return cadenafecha;

    }
       private String  fechaeuropea(Date fecha) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("dd-MM-yyyy");
       String cadenafecha="";

       cadenafecha= formateadorestaeuropa.format(fecha);
       return cadenafecha;

    }
     private String DiaSemana(String fe) {
         String dia = "";
       java.util.Date fecha=null;
         try
            {
             fecha = formateador.parse(fe);

           }
        catch (ParseException e)
            {
            //Error, la cadena de texto no se puede convertir en fecha.
            }
        Calendar cal= Calendar.getInstance();
        cal.setTime(fecha);
        //ojo para establecer o recetear cada parte de la fecha por separado
        //cal.set(Calendar.YEAR, fecha.getYear());
        //cal.set(Calendar.MONTH, fecha.getMonth());
        //cal.set(Calendar.DAY_OF_MONTH, fecha.getDay());
        int diaInt = cal.get(Calendar.DAY_OF_WEEK);
        switch (diaInt) {
            case 1:
                dia = "Domingo";
                break;
            case 2:
                dia = "Lunes";
                break;
            case 3:
                dia = "Martes";
                break;
            case 4:
                dia = "Miercoles";
                break;
            case 5:
                dia = "Jueves";
                break;
            case 6:
                dia = "Viernes";
                break;
            case 7:
                dia = "Sabado";
                break;

        }
        return dia;
    }
 private String fechaamericana(Date fe) {
       SimpleDateFormat formateadorestaeuropa = new SimpleDateFormat("yyyy-MM-dd");
       String cadenafecha="";
       cadenafecha= formateadorestaeuropa.format(fe);
       return cadenafecha;

    }

 private void agregarindicadorgeneral(){

      String sfechaprog=this.fechaamericana(this.jdc_fechaprogramada.getDate());
      String sfechaini=this.fechaamericana(this.jdc_rangoini.getDate());
      String sfechafin=this.fechaamericana(this.jdc_rangofinal.getDate());
      String confirma="";
      String texto="select * from x1_supervision_indicadores_prog_insert('"+sfechaprog+"','"+sfechaini+"','"+sfechafin+"','"+this.jtf_describe.getText().toUpperCase().trim()+"','"+this.jtf_observaindica.getText().toUpperCase().trim()+"',1);";


            try
            {
            rs = x.sieuno_executediversosv2(texto,variables_global.getconexiongral());
               while (rs.next())
                    {
                      confirma=rs.getString(1);
                    }
             }
            catch(Exception e)
            {
                System.out.println(e.getMessage());
            }
         if (confirma.equals("1"))
              {
                JOptionPane.showMessageDialog(null,"Gracias tu Indicador ha sido Programado Correctamente", "Sistema Integral Indicador",1);
                this.jtf_describe.setText("");
                this.jtf_observaindica.setText("");
                this.jtf_describe.getText();
              }
         else
              {
                JOptionPane.showMessageDialog(null,"Error Consulte con Su Administrador", "Sistema Integral Indicadores",1);
                this.jtf_describe.getText();
              }
   }
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new supervision_indicadores_aplica().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JButton jbtn_guardar;
    private javax.swing.JButton jbtn_guardasolicitud;
    private javax.swing.JComboBox jcbx_filtrosencuenta;
    private javax.swing.JComboBox jcbx_filtrostatus;
    private com.toedter.calendar.JDateChooser jdc_fechaprogramada;
    private com.toedter.calendar.JDateChooser jdc_rangofinal;
    private com.toedter.calendar.JDateChooser jdc_rangoini;
    private javax.swing.JMenuItem jmni_actualizar;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JTable jt_catempleados;
    private javax.swing.JTable jt_catindicadores;
    private javax.swing.JTable jt_catpreguntas;
    private javax.swing.JTable jt_catrespuestas;
    private javax.swing.JTextField jtf_describe;
    private javax.swing.JTextField jtf_empleadosnombre;
    private javax.swing.JTextField jtf_obserencuesta;
    private javax.swing.JTextField jtf_observaindica;
    private javax.swing.JTextField jtf_observarespuesta;
    // End of variables declaration//GEN-END:variables

}
